{% import "helpers/forms.html" as forms %}

{% extends 'layout.html' %}

{% block content %}
<h2>
    {% if club %}
    Modifier {{ club['Nom_Club'] }}
    {% else %}
    Ajouter nouveau club
    {% endif %}
</h2>

<form class="form-horizontal" method="POST">
    <fieldset>
        <legend>Info general</legend>
        {{ forms.horinput('Nom_Club', 'Nom', club['Nom_Club']) }}
    </fieldset>

	<fieldset id="bureau">
		<legend>Bureau</legend>

		<div class="control-group">
			<div class="controls">
				<a href="javascript:;" class="ajout btn">Ajouter un adherent du bureau</a>
			</div>
		</div>

		<div id="adherents">
		</div>

		<div id="bureau-adherent-prototype" class="adherent">
			<div class="control-group">
				<div class="controls">
					<select disabled class="type-choix" name="adherent[][type]">
						<option value="existante">Personne existant</option>
						<option value="nouvelle">Nouvelle personne</option>
					</select>

					<select disabled class="type type-existante" name="adherent[][numero_personne]">
						{% for p in personnes %}
						<option value="{{p['Numero_Personne']}}">
							{{p['Nom']}}, {{p['Prenom']}}
						</option>
						{% endfor %}
					</select>

					<input disabled class="type type-nouvelle" type="text" class="input-nom"
						   placeholder="Nom" name="adherent[][nom]">

					<input disabled type="text" class="role-input"
						   placeholder="Role" name="adherent[][role]">

					<a class="enleve btn" href="javascript:;"><i class="icon-trash"></i></a>
				</div>
			</div>
		</div>

        {% if bureauJson %} <script type="text/javascript">var clubBureau = {{bureauJson|raw}}</script> {% endif %}
	</fieldset>

    <!--
	<fieldset>
        <legend>Equipe</legend>
	</fieldset>
	-->

    {{ forms.horsubmit() }}
</form>
{% endblock %}
